package cn.com.demo.servlet;

import cn.com.demo.pojo.User;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class DemoServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        User user = new User();
        String userName = req.getParameter("userName");
        String userPassword = req.getParameter("userPassword");
        // 接收2个数据
        /*String name = req.getParameter("name");
        String sex = req.getParameter("sex");*/
        // 放入作用域对象
       /* req.setAttribute("name", name);
        req.setAttribute("sex",sex);*/
        req.setAttribute("userName",userName);
        req.setAttribute("userPassword",userPassword);
        // 转向jsp
        req.getRequestDispatcher("/WEB-INF/jsp/demo.jsp").forward(req,resp);
    }
}
